package com.jereh.topnews.util;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

/**
 * Created by Administrator on 2016/11/22.
 */
public class WebUtil {
    /**
     * 设置图片自适应
     * @param content
     * @return
     */
    public static String setImgAutoFit(String content){
        Document document= Jsoup.parse(content);
        Elements imgs=document.getElementsByTag("img");
        for(Element img:imgs){
            img.attr("width","100%");
            img.attr("height","auto");
        }
        return document.toString();
    }
}
